﻿using System;

namespace KelonProud.Administration.Logs
{
    /// <summary>
    /// 实体日志记录标签
    /// </summary>
    public abstract class LoggingAttribute:Attribute
    {
        /// <summary>
        /// 禁止记录插入
        /// </summary>
        public bool DisableInsert { get; set; }

        /// <summary>
        ///  禁止记录更新
        /// </summary>
        public bool DisableUpdate { get; set; }

        /// <summary>
        ///  禁止记录删除
        /// </summary>
        public bool DisableDelete { get; set; }

        public LoggingAttribute() {
            DisableInsert = false;
            DisableUpdate = false;
            DisableDelete = false;
        }

        public LoggingAttribute(bool isDisabled)
        {
            DisableInsert = isDisabled;
            DisableUpdate = isDisabled;
            DisableDelete = isDisabled;
        }
    }

    /// <summary>
    /// 禁止实体日志记录标签
    /// </summary>
    public class DisableLoggingAttribute : LoggingAttribute {
        public DisableLoggingAttribute():base(true) {
            
        }
    }

    /// <summary>
    /// 禁止实体日志记录插入标签
    /// </summary>
    public class DisableInsertLoggingAttribute : LoggingAttribute {
        public DisableInsertLoggingAttribute():base(false) {
            DisableInsert = true;
        }
    }

    /// <summary>
    /// 禁止实体日志记录更新标签
    /// </summary>
    public class DisableUpdateLoggingAttribute : LoggingAttribute
    {
        public DisableUpdateLoggingAttribute():base(false) {
            DisableUpdate = true;
        }
    }

    /// <summary>
    /// 禁止实体日志记录删除标签
    /// </summary>
    public class DisableDeleteLoggingAttribute : LoggingAttribute
    {
        public DisableDeleteLoggingAttribute():base(false) {
            DisableDelete = true;
        }
    }

}
